package swa2012.telco.provider;

import java.util.ArrayList;
import java.util.List;

import swa2012.telco.broker.Client;

public class ClientContainer {
	private static ClientContainer instance = new ClientContainer();
	private List<Client> clientList = new ArrayList<Client>();
	
	private ClientContainer() {}
	
	public static ClientContainer getInstance() {
		return instance;
	}
	
	public void registerClient(Client client) {
		clientList.add(client);
	}
	
	public void unregisterClient(Client client) {
		String id = client.getID();
		int index = 0;
		for(Client c : clientList) {
			if(c.getID().equals(id)) {
				index = clientList.indexOf(c);
			}
		}
		clientList.remove(index);
	}
	
	public List<Client> getClientList() {
		return clientList;
	}
}
